﻿
Namespace Dados

    Public Class Conexao

        Public Function RetornarDataTable(ByVal strQuery As String) As DataTable

            Try

                Dim connString As String = My.Settings.LoLSimulatorConnectionString

                Dim objConnection As New SqlClient.SqlConnection(connString)

                Dim objCommand As New SqlClient.SqlCommand(strQuery, objConnection)

                Dim objDataTable As New DataTable

                Dim objDataAdapter As New SqlClient.SqlDataAdapter
                objDataAdapter.SelectCommand = objCommand
                objDataAdapter.Fill(objDataTable)

                Return objDataTable

            Catch ex As Exception
                Throw
            End Try

        End Function

        Public Sub Inserir(ByVal strQuery As String)

            Try

                Dim connString As String = My.Settings.LoLSimulatorConnectionString

                Dim objConnection As New SqlClient.SqlConnection(connString)

                Dim objCommand As New SqlClient.SqlCommand(strQuery, objConnection)

                objCommand.ExecuteNonQuery()

            Catch ex As Exception
                Throw
            End Try

        End Sub

        Public Sub Excluir(ByVal strQuery As String)

            Try

                Dim connString As String = My.Settings.LoLSimulatorConnectionString

                Dim objConnection As New SqlClient.SqlConnection(connString)

                Dim objCommand As New SqlClient.SqlCommand(strQuery, objConnection)

                objCommand.ExecuteNonQuery()

            Catch ex As Exception
                Throw
            End Try

        End Sub

        Public Sub Atualizar(ByVal strQuery As String)

            Try

                Dim connString As String = My.Settings.LoLSimulatorConnectionString

                Dim objConnection As New SqlClient.SqlConnection(connString)

                Dim objCommand As New SqlClient.SqlCommand(strQuery, objConnection)

                objCommand.ExecuteNonQuery()

            Catch ex As Exception
                Throw
            End Try

        End Sub

    End Class

End Namespace
